-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for updating the tracing subscriber in LogPlugin #10822
Add support for updating the tracing subscriber in LogPlugin #10822
Conversation
The generated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM sans the member naming.
|
||
/// Optionally apply extra transformations to the tracing subscriber. | ||
/// For example add [`Layers`](tracing_subscriber::layer::Layer) | ||
pub update_subscriber: Option<fn(BoxedSubscriber) -> BoxedSubscriber>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not the biggest fan of this naming, but this work. Not a strict blocker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe extend_tracing_subscriber_fn
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe configure
/configure_callback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current name makes sense to me.configure_subscriber
maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks alright
|
||
/// Optionally apply extra transformations to the tracing subscriber. | ||
/// For example add [`Layers`](tracing_subscriber::layer::Layer) | ||
pub update_subscriber: Option<fn(BoxedSubscriber) -> BoxedSubscriber>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe configure
/configure_callback
Objective
This PR is heavily inspired by #7682
It aims to solve the same problem: allowing the user to extend the tracing subscriber with extra layers.
(in my case, I'd like to use
use metrics_tracing_context::{MetricsLayer, TracingContextLayer};
)Solution
I'm proposing a different api where the user has the opportunity to take the existing
subscriber
and apply any transformations on it.Changelog
update_subscriber
option on theLogPlugin
that lets the user modify thesubscriber
(for example to extend it with more tracingLayers
Migration Guide
update_subscriber
in theLogPlugin